package com.huaxia.service.goOn;

import com.huaxia.dao.goOn.BranchGoOnMapper;
import com.huaxia.dao.goOn.SaleDeptGoOnMapper;
import com.huaxia.pojo.goOn.BranchGoOn;
import com.huaxia.pojo.goOn.SaleDeptGoOn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wangli 爱我华夏，爱我中华！
 * @date 2020/06/10 17:18
 */
@Service
public class GoOnService {

    @Autowired
    private BranchGoOnMapper branchGoOnMapper;
    @Autowired
    private SaleDeptGoOnMapper saleDeptGoOnMapper;

    public List<BranchGoOn> getBranchGoOn13(){
        List<BranchGoOn> branchGoOn = branchGoOnMapper.getBranchGoOn();
        branchGoOn.sort((a, b) -> b.getBranch13jYearYield().compareTo(a.getBranch13jYearYield()));
        return branchGoOn;
    }

    public List<BranchGoOn> getBranchGoOn25(){
        List<BranchGoOn> branchGoOn = branchGoOnMapper.getBranchGoOn();
        branchGoOn.sort((a, b) -> b.getBranch25jYearYield().compareTo(a.getBranch25jYearYield()));
        return branchGoOn;
    }

    public List<SaleDeptGoOn> getSaleDeptGoOn13(){
        List<SaleDeptGoOn> saleDeptGoOn = saleDeptGoOnMapper.getSaleDeptGoOn();
        saleDeptGoOn.sort((a, b) -> b.getSaleDept13jYearYield().compareTo(a.getSaleDept13jYearYield()));
        return saleDeptGoOn;
    }

    public List<SaleDeptGoOn> getSaleDeptGoOn25(){
        List<SaleDeptGoOn> saleDeptGoOn = saleDeptGoOnMapper.getSaleDeptGoOn();
        saleDeptGoOn.sort((a, b) -> b.getSaleDept25jYearYield().compareTo(a.getSaleDept25jYearYield()));
        return saleDeptGoOn;
    }
}
